import Vue from 'vue'
import VueRouter from 'vue-router'
import Index from '../views/Index.vue'
import BusinessList from '../views/BusinessList.vue'
import BusinessInfo from '../views/BusinessInfo.vue'
import Login from '../views/Login.vue'
import Orders from '../views/Orders.vue'
import UserAddress from '../views/UserAddress.vue'
import Payment from '../views/Payment.vue'
import OrderList from '../views/OrderList.vue'
import AddUserAddress from '../views/AddUserAddress.vue'
import EditUserAddress from '../views/EditUserAddress.vue'
import Register from '../views/Register.vue'
import My from '../views/My.vue'
import VirtualWallet from "@/views/VirtualWallet.vue";
import Star from '@/views/Star.vue';
import PayList from "@/views/PayList.vue";
import Charts from "@/views/Charts.vue";
import Person from "@/views/Person.vue";
import ChangeImg from "@/views/ChangeImg.vue";
import ChangeName from "@/views/ChangeName.vue";
import ChangeSex from "@/views/ChangeSex.vue";
import ChangePassword from "@/views/ChangePassword.vue";
import AI from "@/views/AI.vue";
import IntegralList from "@/views/IntegralList.vue";
import Error403 from "@/components/Error403.vue";
Vue.use(VueRouter)



const routes = [{
  path: '/',
  name: 'Home',
  component: Index
},
  {
    path: '/index',
    name: 'Index',
    component: Index
  },
  {
    path: '/businessList',
    name: 'BusinessList',
    component: BusinessList
  },
  {
    path: '/businessInfo',
    name: 'BusinessInfo',
    component: BusinessInfo
  },
  {
    path: '/login',
    name: 'Login',
    component: Login
  },
  {
    path: '/orders',
    name: 'Orders',
    component: Orders
  },
  {
    path: '/userAddress',
    name: 'UserAddress',
    component: UserAddress
  },
  {
    path: '/payment',
    name: 'Payment',
    component: Payment
  }, {
    path: '/orderList',
    name: 'OrderList',
    component: OrderList
  },
  {
    path: '/addUserAddress',
    name: 'AddUserAddress',
    component: AddUserAddress
  },
  {
    path: '/editUserAddress',
    name: 'EditUserAddress',
    component: EditUserAddress
  },
  {
    path: '/register',
    name: 'Register',
    component: Register
  },
  {
    path: '/my',
    name: 'My',
    component: My
  },
  {
    path: '/virtualWallet',
    name: 'VirtualWallet',
    component: VirtualWallet
  },
  {
    path: '/star',
    name: 'Star',
    component: Star
  },
  {
    path: '/payList',
    name: 'PayList',
    component: PayList
  },
  {
    path: '/charts',
    name: 'Charts',
    component: Charts
  },
  {
    path: '/person',
    name: 'Person',
    component: Person
  },
  {
    path: '/changeImg',
    name: 'ChangeImg',
    component: ChangeImg
  },
  {
    path: '/changeName',
    name: 'ChangeName',
    component: ChangeName
  },
  {
    path: '/changeSex',
    name: 'ChangeSex',
    component: ChangeSex
  },
  {
    path: '/changePassword',
    name: 'ChangePassword',
    component: ChangePassword
  },
  {
    path: '/ai',
    name: 'AI',
    component: AI
  },
  {
    path: '/integralList',
    name: 'IntegralList',
    component: IntegralList
  },
  {
    path: '/error403',
    name: 'Error403',
    component: Error403
  }

]

//解决重复路由报异常问题
const originalPush = VueRouter.prototype.push;
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})
export default router
